flowbox: Fix get_child_at_pos
authorTimm Bäder <mail@baedert.org>
Sat, 22 Jul 2017 04:52:08 +0000 (06:52 +0200)
committerTimm Bäder <mail@baedert.org>
Sat, 22 Jul 2017 04:52:46 +0000 (06:52 +0200)
gtk/gtkflowbox.c

index 6a26d3570c6ea7cd3e461095dee249ebf9abb9f5..dde07b7d8484a0929689e7093a6d20b41c4a3855 100644 (file)
@@ -3991,9 +3991,6 @@ gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
   GtkWidget *child;
   GSequenceIter *iter;
   GtkAllocation allocation;
-  GtkAllocation box_allocation;
-
-  gtk_widget_get_allocation (GTK_WIDGET (box), &box_allocation);
 
   for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
        !g_sequence_iter_is_end (iter);
@@ -4004,10 +4001,7 @@ gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
         continue;
 
       gtk_widget_get_allocation (child, &allocation);
-      allocation.x -= box_allocation.x;
-      allocation.y -= box_allocation.y;
-      if (x >= allocation.x && x < (allocation.x + allocation.width) &&
-          y >= allocation.y && y < (allocation.y + allocation.height))
+      if (gdk_rectangle_contains_point (&allocation, x, y))
         return GTK_FLOW_BOX_CHILD (child);
     }